<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./1.css">
</head>
<body>
    <h2>欢迎来到我的小站</h2>
    <script>
        // 获取h2
       let h2 = document.querySelector('h2');
        //  点击事件
        h2.onclick=function(){
            alert('点击一下');
        }  
    </script>
</body>
</html>